import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Test3 {
    public static void main(String[] args) {
        Collection c1=new ArrayList();
        Collection c2=new ArrayList();

        c1.add("奔驰");
        c1.add("奥迪");
        c1.add("宝马");
        c1.add("大众");

        Iterator <String> itor=c1.iterator();
        while(itor.hasNext())
        {
            String tmp = itor.next();
            if(tmp=="奥迪")
            {
                itor.remove();
            }
        }
        // 加强型for遍历集合容器
        for(Object i:c1)
        {
            System.out.println(i);
        }

        System.out.println(c1);
    }
}
